/*
DATE: 2021/12/07
AUTHOR: chenyihui
Desc:

*/
package dingtalk

// at option
type atOption interface {
	apply(m *atMdl)
}

type atOptFunc func(m *atMdl)

func (f atOptFunc) apply(m *atMdl) {
	f(m)
}

func newAtOption(f func(m *atMdl)) atOptFunc {
	return f
}

func WithAtAll() atOption {
	return newAtOption(func(m *atMdl) {
		m.IsAtAll = true
	})
}

func WithAtMobiles(mobiles ...string) atOption {
	return newAtOption(func(m *atMdl) {
		m.AtMobiles = mobiles
	})
}

func WithAtUserIds(userIds ...string) atOption {
	return newAtOption(func(m *atMdl) {
		m.AtUserIds = userIds
	})
}

// action card option
type acOption interface {
	apply(m *actionCardMdl)
}

type acOptFunc func(m *actionCardMdl)

func (f acOptFunc) apply(m *actionCardMdl) {
	f(m)
}

func newAcOption(f func(m *actionCardMdl)) acOptFunc {
	return f
}

func WithCardBtnVertical() acOption {
	return newAcOption(func(m *actionCardMdl) {
		m.BtnOrientation = vertical
	})
}

func WithCardBtnHorizontal() acOption {
	return newAcOption(func(m *actionCardMdl) {
		m.BtnOrientation = horizontal
	})
}

func WithSingleTitle(title string) acOption {
	return newAcOption(func(m *actionCardMdl) {
		m.Title = title
	})
}

func WithSingleUrl(url string) acOption {
	return newAcOption(func(m *actionCardMdl) {
		m.SingleURL = url
	})
}

func WithCardBtns(btns ...ActionCardMultiBtnMdl) acOption {
	return newAcOption(func(m *actionCardMdl) {
		m.Btns = btns
	})
}
